package com.cgmnx.admin.model.enums.rbac;


import com.cgmnx.admin.common.enums.EnumTrait;

public enum UserStatus implements EnumTrait {
    /**
     * 账号状态-启用
     */
    ENABLE(0, "启用"),

    /**
     * 账号状态-禁用
     */
    DISABLE(1, "禁用");


    private int code;

    private String desc;

    UserStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据code转换成枚举
     */
    public static UserStatus codeOf(int code) {
        for (UserStatus status : UserStatus.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
